<template>
    <div class="demo-container">
      <!-- 自定义组件引用 -->
      <!-- <c-no-data imgName="icon-no-student.png" text="暂无数据" /> -->
      <h3>demo</h3>
      <div @click="publish">发布订阅</div>
    </div>
</template>

<script>
import eventListener from "@/eventListener";

export default {
  name: "Demo",
  created() {
    eventListener.unSubscribe("testEv", this.testEv); // 取消订阅
    eventListener.subscribe("testEv", this.testEv); // 开始订阅
  },
  methods: {
    publish() {
      eventListener.notify("testEv", {
        name: "test"
      });
    },
    testEv(params) {
      console.log(params);
    }
  }
};
</script>
